package com.huiyeji.hui.entity;

import com.huiyeji.hui.utils.Login;
import com.huiyeji.hui.utils.Register;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;

/**
 * @author zhaoduo
 */
public class UserInfoEntity {

    @Pattern(regexp = "[0-9a-zA-Z]{6,16}",message = "用户名不合法",groups = {Login.class,Register.class})
    private String username;

    @Pattern(regexp = "^[a-zA-Z0-9.]{6,16}$",message = "密码不合法",groups = {Login.class,Register.class})
    private String password;

    @Null(groups = {Login.class})
    @NotEmpty(groups = {Register.class})
    private String confirmPwd;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getConfirmPwd() {
        return confirmPwd;
    }

    public void setConfirmPwd(String confirmPwd) {
        this.confirmPwd = confirmPwd;
    }

    @Override
    public String toString() {
        return "UserInfoEntity{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", confirmPwd='" + confirmPwd + '\'' +
                '}';
    }
}
